#
# The compiler and its flags
#
CXX= g++ 
INCLUDE=-I ../common
CXXFLAGS= -g -Wall $(INCLUDE)
LIBS= #-lnsl
#
# Sources and objects
#



COMMON=../common/error.cc\
	../common/signal.cc\
	../common/socketio.cc\
        ../common/hrtimer_x86.cc

PROGRAM1=client1
SRC1=client1.cc
SRCS1=$(SRC1) $(COMMON)
OBJS1=$(SRCS1:.cc=.o)

PROGRAM2=client2
SRC2=client2.cc
SRCS2=$(SRC2) $(COMMON)
OBJS2=$(SRCS2:.cc=.o)

PROGRAM3=client3
SRC3=client3.cc
SRCS3=$(SRC3) $(COMMON)
OBJS3=$(SRCS3:.cc=.o)

PROGRAM4=client4
SRC4=client4.cc
SRCS4=$(SRC4) $(COMMON)
OBJS4=$(SRCS4:.cc=.o)

PROGRAMS=$(PROGRAM1) $(PROGRAM2) $(PROGRAM3) $(PROGRAM4)

all: $(PROGRAMS)

$(PROGRAM1): $(OBJS1)
	$(CXX) $(CXXFLAGS) -o $@ $(OBJS1) $(LIBS)

$(PROGRAM2): $(OBJS2)
	$(CXX) $(CXXFLAGS) -o $@ $(OBJS2) $(LIBS) -lpthread

$(PROGRAM3): $(OBJS3)
	$(CXX) $(CXXFLAGS) -o $@ $(OBJS3) $(LIBS)

$(PROGRAM4): $(OBJS4)
	$(CXX) $(CXXFLAGS) -o $@ $(OBJS4) $(LIBS)

clean:
	@echo "Removing objects..."
	rm -f $(PROGRAMS) *.o *~ core
